<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>类别</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<script type="text/javascript" src="scripts/jquery-1.9.1.min.js"
			language="javascript"></script>
		<script type="text/javascript">
	    $(function() {
		   // alert("fff");
		  
		    laodCategory(0,"Category1");
		    $("#Category1").change(function() {
			   // alert("111");
				if ($("#Category1").get(0).selectedIndex == 0) {
					 /// alert("222");
					var trs1 = "<option value=''>请选择二级分类</option>";
					$("#Category2").html(trs1);
				}else{
					 // alert("333");
				    laodCategory($("#Category1").val(),"Category2");
					//loadSecondLevelTradeCode($("#Category1").val());
				}
			});
		    $("#Category2").change(function() {
				   // alert("111");
					if ($("#Category2").get(0).selectedIndex == 0) {
						 /// alert("222");
						var trs1 = "<option value=''>请选择二级分类</option>";
						$("#Category2").html(trs1);
					}else{
						 // alert("333");
					    laodCategory($("#Category2").val(),"Category3");
						//loadSecondLevelTradeCode($("#Category1").val());
					}
				});
	    });
	   
	    function laodCategory(parentId,nodeId){
	    	alert(parentId);
		    alert(nodeId);
	    	$.ajax({ 
	    		type : "POST",
	    		dataType : "json",
	    		url : 'system/loadCategoryByPid.shtml', 
	    		data : "parentId="+parentId,
	    		success : function(data) {
	    		    alert(data);
	    			var myData = data.categoryList;
	    			var trs = "<option value=''>请选择类别</option>";
	    			$.each(myData, function(i, n) {
	    				var name = n.categoryname;
	    				var code = n.categoryid;
	    			    trs += "<option value='" + code + "'>" + name + "</option>";
	    			});
	    			alert(trs);
	    			//$("#"+nodeId+""").html(trs);
	    			$("#"+nodeId).html(trs);
	    		}
	       });
	    }
	    </script>
	</head>
	<body>
		<label class="form_th">
			<font class="red pr5">*</font>类别：
		</label>
		<select id="Category1" class="ylz_select" style="width: 120px;"
			onchange="">
			<option value="">
				一级分类
			</option>
		</select>
		<select id="Category2" class="ylz_select" style="width: 120px;">
			<option value=''>
				二级分类
			</option>
		</select>
		<select id="Category3" class="ylz_select" style="width: 120px;">
			<option value=''>
				三级级分类
			</option>
		</select>

	</body>
</html>
